﻿Public Class clInventario
    Protected _Objetos As New List(Of clObjeto)
    Protected _Cabeza As clObjeto
    Protected _Cuerpo As clObjeto
    Protected _pies As clObjeto
    Protected _Manos As clObjeto
    Protected _Brazos As clObjeto
    Protected _Arma As clObjeto
    Public Property Llaves As Integer = 0
    Public Property Cabeza As clObjeto
        Get
            Return _Cabeza
        End Get
        Set(ByVal value As clObjeto)
            If Not value.Tipo = clObjeto.ElTipo.Cabeza Then Exit Property
            If Not _Objetos.Contains(value) Then Exit Property
            If _Cabeza Is Nothing Then
                _Cabeza = value
                _Objetos.Remove(value)
            Else
                _Objetos.Add(_Cabeza)
                _Objetos.Remove(value)
                _Cabeza = value
            End If
        End Set
    End Property
    Public Property Cuerpo As clObjeto
        Get
            Return _Cuerpo
        End Get
        Set(ByVal value As clObjeto)
            If Not value.Tipo = clObjeto.ElTipo.Cuerpo Then Exit Property
            If Not _Objetos.Contains(value) Then Exit Property
            If _Cuerpo Is Nothing Then
                _Cuerpo = value
                _Objetos.Remove(value)
            Else
                _Objetos.Add(_Cuerpo)
                _Objetos.Remove(value)
                _Cuerpo = value
            End If
        End Set
    End Property
    Public Property Pies As clObjeto
        Get
            Return _pies
        End Get
        Set(ByVal value As clObjeto)
            If Not value.Tipo = clObjeto.ElTipo.Pies Then Exit Property
            If Not _Objetos.Contains(value) Then Exit Property
            If _pies Is Nothing Then
                _pies = value
                _Objetos.Remove(value)
            Else
                _Objetos.Add(_pies)
                _Objetos.Remove(value)
                _pies = value
            End If
        End Set
    End Property
    Public Property Manos As clObjeto
        Get
            Return _Manos
        End Get
        Set(ByVal value As clObjeto)
            If Not value.Tipo = clObjeto.ElTipo.Manos Then Exit Property
            If Not _Objetos.Contains(value) Then Exit Property
            If _Manos Is Nothing Then
                _Manos = value
                _Objetos.Remove(value)
            Else
                _Objetos.Add(_Manos)
                _Objetos.Remove(value)
                _Manos = value
            End If
        End Set
    End Property
    Public Property Brazos As clObjeto
        Get
            Return _Brazos
        End Get
        Set(ByVal value As clObjeto)
            If Not value.Tipo = clObjeto.ElTipo.Brazos Then Exit Property
            If Not _Objetos.Contains(value) Then Exit Property
            If _Brazos Is Nothing Then
                _Brazos = value
                _Objetos.Remove(value)
            Else
                _Objetos.Add(_Brazos)
                _Objetos.Remove(value)
                _Brazos = value
            End If
        End Set
    End Property
    Public Property Arma As clObjeto
        Get
            Return _Arma
        End Get
        Set(ByVal value As clObjeto)
            If Not value.Tipo = clObjeto.ElTipo.Arma Then Exit Property
            If Not _Objetos.Contains(value) Then Exit Property
            If _Arma Is Nothing Then
                _Arma = value
                _Objetos.Remove(value)
            Else
                _Objetos.Add(_Arma)
                _Objetos.Remove(value)
                _Arma = value
            End If
        End Set
    End Property
    Public ReadOnly Property Objetos As ObjectModel.ReadOnlyCollection(Of clObjeto)
        Get
            Return _Objetos.AsReadOnly
        End Get
    End Property
    Public Sub AñadirObjeto(ByVal objeto As clObjeto)
        _Objetos.Add(objeto)
    End Sub

    

End Class
